Compare two unordered Lists (not sets)ΒΆ

import Counter

Compare two unordered Lists (not sets).

Output:

.. code-block:: py

from collections import Counter

def compare_lists(x, y):

return Counter(x) == Counter(y)

# test L1 = [20, 10, 30, 10, 20, 30] L2 = [30, 20, 10, 30, 20, 50]

print(compare_lists(L1, L2))

Output:

False